"""
发帖页面的元素
"""

from selenium.webdriver.common.by import By

from pom.baseActivity import BaSeActivity
class TopicActivity(BaSeActivity):
    def __init__(self):
        self._topic_tab = (By.ID,'org.cnodejs.android.md:id/spn_tab')
        self._topic_title = (By.ID,'org.cnodejs.android.md:id/edt_title')
        self._topic_content= (By.ID,'org.cnodejs.android.md:id/edt_content')

    @property
    def topic_tab(self):
        return self.driver.find_element(*self._topic_tab)

    @property
    def topic_title(self):
        return self.driver.find_element(*self._topic_title)

    @property
    def topic_content(self):
        return self.driver.find_element(*self._topic_content)

    def topic_choose_tab(self,tab_name):
        if tab_name == None:
            tab_name = "测试"
        return self.driver.find_element(By.XPATH,f'//*[@resource-id="android:id/text1" and @text="{tab_name}"]')

    def click_action_send(self):
        self.driver.find_element_by_accessibility_id('发送').click()

    @property
    def get_toast_text(self):
        return self.get_Toast.text